package ctype

import "github.com/goccy/go-json"

type Role int

const (
	PermissionAdmin       Role = 1 //管理员
	PermissionUser        Role = 2 //普通登录人
	PermissionVisitor     Role = 3 //游客
	PermissionDisobleUser Role = 4 //被禁用的用户
)

func (s Role) MarshalJSON() ([]byte, error) {
	return json.Marshal(string(rune(s)))
}

func (s Role) String() string {
	var str string
	switch s {
	case PermissionAdmin:

		str = "管理员"
	case PermissionUser:

		str = "普通股登录人"
	case PermissionVisitor:

		str = "游客"
	case PermissionDisobleUser:

		str = "被禁用的用户"
	default:

		str = "其他"
	}
	return str
}
